﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ExternalConnections.CUiPLCSimAdvacnedConnection
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using DnProcessSimulateCommands.ExternalConnections.Res;
using EngineeringInternalExtension;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Net;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.PrivateImplementationDetails;
using Tecnomatix.Engineering.Ui;
using UiInternalControls;
using UiInternalControls.GeneralWindowsControls;


namespace DnProcessSimulateCommands.ExternalConnections;

public class CUiPLCSimAdvacnedConnection : TxForm
{
  private IApECExternalConnectionDataConvertor m_convertor = (IApECExternalConnectionDataConvertor) new CApECExternalConnectionDataEditConvertor();
  private CApECPLcSimAdvancedConnectionFormParams m_params;
  private TxSimaticSimulationRuntime m_instance;
  private int m_suspendEnablersCounter;
  private string m_caption;
  private ToolTip m_buttonToolTip = new ToolTip();
  private CApECExternalConnectionsManager m_dataMgr;
  private ToolTip _infoToolTip = new ToolTip();
  private IContainer components;
  private Button m_okButton;
  private Label label1;
  private Label m_hostNameLabel;
  private Label label3;
  private TextBox m_name;
  private TextBox m_IP;
  private Label m_portLabel;
  private NumericTextBox m_port;
  private RadioButton m_localradioButton;
  private RadioButton m_remoteradioButton;
  private Button m_cancelButton;
  private Label label6;
  private ComboBox m_conections;
  private Button m_refreshButton;
  private Label label2;
  private ComboBox m_signalMapping;
  private ToolTip toolTip1;
  private ComboBox tagAccessMode;
  private Label label4;
  private TxInfoButton m_infoBox;
  private Button m_browseButton;

  public CUiPLCSimAdvacnedConnection(CApECExternalConnectionsManager mgr)
  {
    this.InitializeComponent();
    this._infoToolTip.AutoPopDelay = 30000;
    this._infoToolTip.InitialDelay = 500;
    this._infoToolTip.ReshowDelay = 150;
    this._infoToolTip.ShowAlways = true;
    this.m_dataMgr = mgr;
    this.m_port.Enter += new EventHandler(this.OnEnterPort);
    this.m_instance = new TxSimaticSimulationRuntime();
    this.m_port.Text = "4048";
    this.EnalbeOKButton();
    this.LoadBrowseIpButton();
    this.m_localradioButton.Checked = true;
    this.PopulateInstanceNames();
  }

  private bool isPlcRecorderOn()
  {
    return TxFeatureManager.CheckFeature("PLC_RECORDER") && TxApplication.Options.Units.LinearDigitsAfterDecimalPoint == 9;
  }

  [DllImport("user32.dll")]
  private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);

  protected void LoadBrowseIpButton()
  {
    this.m_buttonToolTip.SetToolTip((Control) this.m_browseButton, CUiECExternalConnectionsResourceTable.BROWSE_DOMAIN_CAPTION);
  }

  protected virtual void OnLoad(EventArgs e)
  {
    this.ShowRemoteConnectionFields();
    this._infoToolTip.SetToolTip((Control) this.m_infoBox, CUiECExternalConnectionsResourceTable.PLCSIM_ADVANCED_AccessMode_INFO);
    this.m_infoBox.TooltipText = CUiECExternalConnectionsResourceTable.PLCSIM_ADVANCED_AccessMode_INFO;
    base.OnLoad(e);
  }

  internal DialogResult ShowDialog(CApECPLcSimAdvancedConnectionFormParams formParams)
  {
    this.InitMode(formParams);
    this.m_buttonToolTip.SetToolTip((Control) this.m_refreshButton, CUiECExternalConnectionsResourceTable.RELOAD_PLC_CAPTION);
    return ((Form) this).ShowDialog();
  }

  public CApECPLcSimAdvancedConnectionFormParams Params => this.m_params;

  public void InitMode(CApECPLcSimAdvancedConnectionFormParams formParams)
  {
    this.m_params = formParams;
    this.SuspendUiEnablers();
    try
    {
      switch (this.m_params.DialogMode)
      {
        case CApECPLcSimAdvancedConnectionFormParams.eMode.Edit:
          if (this.m_params.ConnectionToEdit.Data is TxPlcSimAdvConnectionDataEx data)
            this.InitUiByData(data, false);
          this.m_caption = CUiECExternalConnectionsResourceTable.EDIT_PLCSIM_ADVANCED_CONNECTION_DLG_CAPTION;
          this.m_name.Focus();
          this.m_name.SelectAll();
          break;
        case CApECPLcSimAdvancedConnectionFormParams.eMode.Create:
          this.InitUiByData(new TxPlcSimAdvConnectionDataEx(), false);
          this.m_caption = CUiECExternalConnectionsResourceTable.ADD_PLCSIM_ADVANCED_CONNECTION_DLG_CAPTION;
          this.m_name.Focus();
          break;
      }
      ((Control) this).Text = this.m_caption;
    }
    finally
    {
      this.ResumeUiEnablers();
    }
  }

  public void MapSignalsByName() => this.m_signalMapping.SelectedIndex = 0;

  public void MapSignalsByAddress() => this.m_signalMapping.SelectedIndex = 1;

  private void InitUiByData(TxPlcSimAdvConnectionDataEx data, bool updateEnablers)
  {
    IApECExternalConnectionDataConvertor instance = this.m_params.DataConvertor.CreateInstance((ITxPlcExternalConnectionDataEx) data);
    CApECExternalConnectionDataEditConvertor dataEditConvertor = (CApECExternalConnectionDataEditConvertor) instance;
    this.m_name.Text = dataEditConvertor.Name as string;
    this.m_IP.Text = dataEditConvertor.OpcServer as string;
    this.m_signalMapping.Items.Clear();
    object[] signalsByOptions = instance.MapSignalsByOptions;
    if (signalsByOptions != null && signalsByOptions.Length != 0)
    {
      this.m_signalMapping.Items.AddRange(signalsByOptions);
      this.m_signalMapping.SelectedItem = instance.MapSignalsBy;
    }
    this.tagAccessMode.SelectedIndex = data.TagAccessMode;
    if ((bool) dataEditConvertor.IsLocalPLCSIMAdvanced)
    {
      this.m_localradioButton.Checked = true;
      this.m_IP.Text = "";
    }
    else
    {
      this.m_remoteradioButton.Checked = true;
      this.m_port.Text = dataEditConvertor.OpcServerPort as string;
    }
    this.PopulateInstanceNames(dataEditConvertor.InstanceName.ToString());
    if (this.m_params.DialogMode == CApECPLcSimAdvancedConnectionFormParams.eMode.Edit)
    {
      if (this.m_conections.Items.Contains(dataEditConvertor.InstanceName))
      {
        this.m_conections.SelectedItem = dataEditConvertor.InstanceName;
      }
      else
      {
        int num = (int) TxMessageBox.ShowModal(string.Format(CUiECExternalConnectionsResourceTable.INVALID_INSTANCE, (object) dataEditConvertor.InstanceName.ToString()), CUiECExternalConnectionsResourceTable.EDIT_PLCSIM_ADVANCED_CONNECTION_DLG_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
      }
    }
    if (!updateEnablers)
      return;
    this.UpdateAllEnablers();
  }

  private void Action_FormClosing(object sender, FormClosingEventArgs e)
  {
    if (((Form) this).DialogResult == DialogResult.OK)
    {
      ITxPlcExternalConnectionDataEx connectionDataEx = this.RetrieveDataFromUi();
      switch (this.m_params.DialogMode)
      {
        case CApECPLcSimAdvancedConnectionFormParams.eMode.Edit:
          CApECExternalConnectionsManager.eSetConnectionDataFailiureReason failiureReason1;
          if (!this.m_dataMgr.CanSetConnectionData(this.m_params.ConnectionToEdit, connectionDataEx, out failiureReason1))
          {
            e.Cancel = true;
            switch (failiureReason1)
            {
              case CApECExternalConnectionsManager.eSetConnectionDataFailiureReason.DuplicatedName:
                int num1 = (int) TxMessageBox.Show(CUiECExternalConnectionsResourceTable.ERR_MSG_DUPLICATED_CONNECTION_NAME, ((Control) this).Text, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                break;
              case CApECExternalConnectionsManager.eSetConnectionDataFailiureReason.DuplicatedKey:
                int num2 = (int) TxMessageBox.ShowModal(this.m_localradioButton.Checked ? CUiECExternalConnectionsResourceTable.ERR_MSG_PLCSIM_ADV_LOCAL_DUPLICATED_KEY : CUiECExternalConnectionsResourceTable.ERR_MSG_PLCSIM_ADV_REMOTE_DUPLICATED_KEY, ((Control) this).Text, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                break;
            }
          }
          else
            break;
          break;
        case CApECPLcSimAdvancedConnectionFormParams.eMode.Create:
          CApECExternalConnectionsManager.eCreateConnectionFailiureReason failiureReason2;
          if (!this.m_dataMgr.CanCreateConnectionWithData(connectionDataEx, out failiureReason2))
          {
            e.Cancel = true;
            switch (failiureReason2)
            {
              case CApECExternalConnectionsManager.eCreateConnectionFailiureReason.DuplicatedName:
                int num3 = (int) TxMessageBox.Show(CUiECExternalConnectionsResourceTable.ERR_MSG_DUPLICATED_CONNECTION_NAME, ((Control) this).Text, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                break;
              case CApECExternalConnectionsManager.eCreateConnectionFailiureReason.DuplicatedKey:
                int num4 = (int) TxMessageBox.Show(this.m_localradioButton.Checked ? CUiECExternalConnectionsResourceTable.ERR_MSG_PLCSIM_ADV_LOCAL_DUPLICATED_KEY : CUiECExternalConnectionsResourceTable.ERR_MSG_PLCSIM_ADV_REMOTE_DUPLICATED_KEY, ((Control) this).Text, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                break;
            }
          }
          else
            break;
          break;
      }
      if (!e.Cancel)
        this.m_params.DataToApply = connectionDataEx;
      else
        ((Form) this).DialogResult = DialogResult.Cancel;
    }
    base.OnClosing((CancelEventArgs) e);
  }

  private void PopulateInstanceNames(string editedInstanceName = "")
  {
    this.m_conections.Items.Clear();
    if (!this.m_localradioButton.Checked && this.m_IP.Text.Equals(""))
      return;
    ((Control) this).Cursor = Cursors.WaitCursor;
    List<string> stringList = this.FilterInstanceNames(editedInstanceName);
    if (stringList != null && stringList.Count > 0)
    {
      this.m_conections.Items.AddRange((object[]) stringList.ToArray());
      this.m_conections.SelectedIndex = 0;
    }
    ((Control) this).Cursor = Cursors.Default;
  }

  private List<string> FilterInstanceNames(string editedInstanceName)
  {
    List<string> stringList = new List<string>();
    TxPlcSimAdvConnectionDataEx data = new TxPlcSimAdvConnectionDataEx();
    data.LocalConnection = this.m_localradioButton.Checked;
    data.EndpointUrl = this.m_IP.Text;
    int result = 0;
    int.TryParse(this.m_port.Text, out result);
    data.Port = result;
    foreach (string enumInstance in this.m_instance.EnumInstances(data))
    {
      data.EndpointName = enumInstance;
      if (!this.m_dataMgr.IsPlcSimAdvancedConnectionExists((ITxPlcExternalConnectionDataEx) data) || enumInstance.Equals(editedInstanceName))
        stringList.Add(enumInstance);
    }
    if (this.isPlcRecorderOn())
    {
      string str = "Dummy PLCSIM Advanced";
      data.EndpointName = str;
      if (!this.m_dataMgr.IsPlcSimAdvancedConnectionExists((ITxPlcExternalConnectionDataEx) data))
        stringList.Add("Dummy PLCSIM Advanced");
    }
    return stringList;
  }

  private ITxPlcExternalConnectionDataEx RetrieveDataFromUi()
  {
    IApECExternalConnectionDataConvertor instance = this.m_convertor.CreateInstance((ITxPlcExternalConnectionDataEx) new TxPlcSimAdvConnectionDataEx());
    CApECExternalConnectionDataEditConvertor dataEditConvertor = (CApECExternalConnectionDataEditConvertor) instance;
    dataEditConvertor.Name = (object) this.m_name.Text;
    dataEditConvertor.InstanceName = this.m_conections.SelectedItem;
    dataEditConvertor.OpcServer = (object) this.m_IP.Text;
    dataEditConvertor.OpcServerPort = (object) this.m_port.Text;
    dataEditConvertor.TagAccessMode = (object) this.tagAccessMode.SelectedIndex;
    dataEditConvertor.IsLocalPLCSIMAdvanced = (object) this.m_localradioButton.Checked;
    instance.MapSignalsBy = this.m_signalMapping.SelectedItem;
    if (this.m_localradioButton.Checked)
    {
      dataEditConvertor.OpcServerPort = (object) "0";
      dataEditConvertor.OpcServer = (object) "";
    }
    return dataEditConvertor.Data;
  }

  private void OK_Click(object sender, EventArgs e)
  {
    ((Form) this).DialogResult = DialogResult.OK;
    if (((Form) this).Modal)
      return;
    ((Form) this).Close();
  }

  protected virtual void OnClosing(CancelEventArgs e)
  {
    if (((Form) this).DialogResult == DialogResult.OK)
      this.ApplyData();
    base.OnClosing(e);
  }

  public void ApplyData() => this.m_params.DataToApply = this.RetrieveDataFromUi();

  private void m_localradioButton_CheckedChanged(object sender, EventArgs e)
  {
    this.PopulateInstanceNames();
    this.ShowRemoteConnectionFields();
    this.EnalbeOKButton();
  }

  private void m_remoteradioButton_CheckedChanged(object sender, EventArgs e)
  {
    this.PopulateInstanceNames();
    this.ShowRemoteConnectionFields();
    this.EnalbeOKButton();
  }

  private bool EnablersSuspended() => this.m_suspendEnablersCounter > 0;

  private void SuspendUiEnablers() => ++this.m_suspendEnablersCounter;

  private void ResumeUiEnablers()
  {
    if (this.EnablersSuspended())
      --this.m_suspendEnablersCounter;
    if (this.EnablersSuspended())
      return;
    this.UpdateAllEnablers();
  }

  private void UpdateAllEnablers()
  {
    if (this.EnablersSuspended())
      return;
    this.EnalbeOKButton();
  }

  public bool ValidateConnectionFields()
  {
    bool flag = this.m_conections.SelectedItem != null && this.m_conections.SelectedItem.ToString().Trim().Length > 0;
    return this.m_name.Text.Trim().Length > 0 & flag;
  }

  private void EnalbeOKButton()
  {
    if (this.EnablersSuspended())
      return;
    this.m_okButton.Enabled = this.ValidateConnectionFields();
  }

  private void ShowRemoteConnectionFields()
  {
    this.m_hostNameLabel.Enabled = this.m_remoteradioButton.Checked;
    this.m_portLabel.Enabled = this.m_remoteradioButton.Checked;
    this.m_port.Enabled = this.m_remoteradioButton.Checked;
    this.m_refreshButton.Enabled = this.m_remoteradioButton.Checked;
    this.m_IP.Enabled = this.m_remoteradioButton.Checked;
    this.m_browseButton.Enabled = this.m_remoteradioButton.Checked;
  }

  private void m_refreshButton_Click(object sender, EventArgs e)
  {
    if (this.m_conections.SelectedItem != null)
      this.PopulateInstanceNames(this.m_conections.SelectedItem.ToString());
    else
      this.PopulateInstanceNames();
    this.EnalbeOKButton();
  }

  private void m_cancelButton_Click(object sender, EventArgs e)
  {
    ((Form) this).DialogResult = DialogResult.Cancel;
    if (((Form) this).Modal)
      return;
    ((Form) this).Close();
  }

  private void m_name_TextChanged(object sender, EventArgs e) => this.EnalbeOKButton();

  private void m_conections_SelectedIndexChanged(object sender, EventArgs e)
  {
    this.EnalbeOKButton();
  }

  private void OnEnterPort(object sender, EventArgs e)
  {
    if (e == EventArgs.Empty || ((KeyPressEventArgs) e).KeyChar != '\r')
      return;
    if (this.m_IP.Text.Equals(""))
      this.m_IP.Text = "localhost";
    this.PopulateInstanceNames();
    this.EnalbeOKButton();
  }

  private void m_IP_KeyPress(object sender, KeyPressEventArgs e)
  {
    // ISSUE: explicit non-virtual call
    __nonvirtual (((Control) this).OnKeyPress(e));
    if (e.KeyChar == '\r')
    {
      if (this.m_IP.Text.Equals(""))
        this.m_IP.Text = "localhost";
      this.PopulateInstanceNames();
      this.EnalbeOKButton();
    }
    else
    {
      if (e.KeyChar != '\\')
        return;
      e.Handled = true;
    }
  }

  public void SetConnectionName(string connectionName) => this.m_name.Text = connectionName;

  private void m_signalMapping_SelectedIndexChanged(object sender, EventArgs e)
  {
    if (this.m_signalMapping.SelectedIndex == 0)
    {
      this.tagAccessMode.Enabled = true;
    }
    else
    {
      this.tagAccessMode.SelectedIndex = 0;
      this.tagAccessMode.Enabled = false;
    }
  }

  private void m_browseButton_Click(object sender, EventArgs e)
  {
    Dns.GetHostName();
    using (TxFolderBrowserControl folderBrowserControl = new TxFolderBrowserControl())
    {
      BrowseFlags browseFlags = (BrowseFlags) 4096 /*0x1000*/;
      folderBrowserControl.BrowseFlags = browseFlags;
      RootNode rootNode = (RootNode) 18;
      folderBrowserControl.RootNode = rootNode;
      folderBrowserControl.Title = CUiECExternalConnectionsResourceTable.BROWSE_NETWORK_NEIGHBOURHOOD;
      if (!folderBrowserControl.ShowDialog())
        return;
      this.m_IP.Text = folderBrowserControl.FolderDisplayName;
      this.PopulateInstanceNames();
      this.EnalbeOKButton();
    }
  }

  protected virtual void Dispose(bool disposing)
  {
    if (disposing && this.components != null)
      this.components.Dispose();
    base.Dispose(disposing);
  }

  private void InitializeComponent()
  {
    this.components = (IContainer) new Container();
    ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (CUiPLCSimAdvacnedConnection));
    this.m_okButton = new Button();
    this.label1 = new Label();
    this.m_hostNameLabel = new Label();
    this.label3 = new Label();
    this.m_name = new TextBox();
    this.m_IP = new TextBox();
    this.m_portLabel = new Label();
    this.m_localradioButton = new RadioButton();
    this.m_remoteradioButton = new RadioButton();
    this.m_cancelButton = new Button();
    this.label6 = new Label();
    this.m_conections = new ComboBox();
    this.m_refreshButton = new Button();
    this.label2 = new Label();
    this.m_signalMapping = new ComboBox();
    this.toolTip1 = new ToolTip(this.components);
    this.tagAccessMode = new ComboBox();
    this.label4 = new Label();
    this.m_infoBox = new TxInfoButton();
    this.m_browseButton = new Button();
    this.m_port = new NumericTextBox();
    ((Control) this).SuspendLayout();
    componentResourceManager.ApplyResources((object) this.m_okButton, "m_okButton");
    this.m_okButton.Name = "m_okButton";
    this.m_okButton.UseVisualStyleBackColor = true;
    this.m_okButton.Click += new EventHandler(this.OK_Click);
    componentResourceManager.ApplyResources((object) this.label1, "label1");
    this.label1.Name = "label1";
    componentResourceManager.ApplyResources((object) this.m_hostNameLabel, "m_hostNameLabel");
    this.m_hostNameLabel.Name = "m_hostNameLabel";
    componentResourceManager.ApplyResources((object) this.label3, "label3");
    this.label3.Name = "label3";
    componentResourceManager.ApplyResources((object) this.m_name, "m_name");
    this.m_name.Name = "m_name";
    this.m_name.TextChanged += new EventHandler(this.m_name_TextChanged);
    componentResourceManager.ApplyResources((object) this.m_IP, "m_IP");
    this.m_IP.Name = "m_IP";
    this.m_IP.KeyPress += new KeyPressEventHandler(this.m_IP_KeyPress);
    componentResourceManager.ApplyResources((object) this.m_portLabel, "m_portLabel");
    this.m_portLabel.Name = "m_portLabel";
    componentResourceManager.ApplyResources((object) this.m_localradioButton, "m_localradioButton");
    this.m_localradioButton.Checked = true;
    this.m_localradioButton.Name = "m_localradioButton";
    this.m_localradioButton.TabStop = true;
    this.m_localradioButton.UseVisualStyleBackColor = true;
    this.m_localradioButton.CheckedChanged += new EventHandler(this.m_localradioButton_CheckedChanged);
    componentResourceManager.ApplyResources((object) this.m_remoteradioButton, "m_remoteradioButton");
    this.m_remoteradioButton.Name = "m_remoteradioButton";
    this.m_remoteradioButton.UseVisualStyleBackColor = true;
    this.m_remoteradioButton.CheckedChanged += new EventHandler(this.m_remoteradioButton_CheckedChanged);
    componentResourceManager.ApplyResources((object) this.m_cancelButton, "m_cancelButton");
    this.m_cancelButton.Name = "m_cancelButton";
    this.m_cancelButton.UseVisualStyleBackColor = true;
    this.m_cancelButton.Click += new EventHandler(this.m_cancelButton_Click);
    componentResourceManager.ApplyResources((object) this.label6, "label6");
    this.label6.Name = "label6";
    this.m_conections.DropDownStyle = ComboBoxStyle.DropDownList;
    this.m_conections.FormattingEnabled = true;
    componentResourceManager.ApplyResources((object) this.m_conections, "m_conections");
    this.m_conections.Name = "m_conections";
    this.m_conections.Sorted = true;
    this.m_conections.SelectedIndexChanged += new EventHandler(this.m_conections_SelectedIndexChanged);
    componentResourceManager.ApplyResources((object) this.m_refreshButton, "m_refreshButton");
    this.m_refreshButton.Name = "m_refreshButton";
    this.m_refreshButton.UseVisualStyleBackColor = true;
    this.m_refreshButton.Click += new EventHandler(this.m_refreshButton_Click);
    componentResourceManager.ApplyResources((object) this.label2, "label2");
    this.label2.Name = "label2";
    this.m_signalMapping.DropDownStyle = ComboBoxStyle.DropDownList;
    this.m_signalMapping.FormattingEnabled = true;
    componentResourceManager.ApplyResources((object) this.m_signalMapping, "m_signalMapping");
    this.m_signalMapping.Name = "m_signalMapping";
    this.m_signalMapping.SelectedIndexChanged += new EventHandler(this.m_signalMapping_SelectedIndexChanged);
    this.tagAccessMode.DropDownStyle = ComboBoxStyle.DropDownList;
    this.tagAccessMode.FormattingEnabled = true;
    this.tagAccessMode.Items.AddRange(new object[4]
    {
      (object) componentResourceManager.GetString("tagAccessMode.Items"),
      (object) componentResourceManager.GetString("tagAccessMode.Items1"),
      (object) componentResourceManager.GetString("tagAccessMode.Items2"),
      (object) componentResourceManager.GetString("tagAccessMode.Items3")
    });
    componentResourceManager.ApplyResources((object) this.tagAccessMode, "tagAccessMode");
    this.tagAccessMode.Name = "tagAccessMode";
    componentResourceManager.ApplyResources((object) this.label4, "label4");
    this.label4.Name = "label4";
    componentResourceManager.ApplyResources((object) this.m_infoBox, "m_infoBox");
    ((Control) this.m_infoBox).Name = "m_infoBox";
    this.m_infoBox.TooltipDuration = 5000;
    this.m_infoBox.TooltipText = (string) null;
    this.m_infoBox.TooltipTitle = "";
    this.m_infoBox.Type = (TxInfoButton.InfoType) 0;
    componentResourceManager.ApplyResources((object) this.m_browseButton, "m_browseButton");
    this.m_browseButton.Name = "m_browseButton";
    this.m_browseButton.UseVisualStyleBackColor = true;
    this.m_browseButton.Click += new EventHandler(this.m_browseButton_Click);
    this.m_port.AllowSpace = false;
    this.m_port.IsPortNumericBox = true;
    componentResourceManager.ApplyResources((object) this.m_port, "m_port");
    this.m_port.Name = "m_port";
    componentResourceManager.ApplyResources((object) this, "$this");
    ((ContainerControl) this).AutoScaleMode = AutoScaleMode.Font;
    ((Control) this).Controls.Add((Control) this.m_browseButton);
    ((Control) this).Controls.Add((Control) this.m_infoBox);
    ((Control) this).Controls.Add((Control) this.tagAccessMode);
    ((Control) this).Controls.Add((Control) this.label4);
    ((Control) this).Controls.Add((Control) this.m_signalMapping);
    ((Control) this).Controls.Add((Control) this.label2);
    ((Control) this).Controls.Add((Control) this.m_refreshButton);
    ((Control) this).Controls.Add((Control) this.m_conections);
    ((Control) this).Controls.Add((Control) this.label6);
    ((Control) this).Controls.Add((Control) this.m_cancelButton);
    ((Control) this).Controls.Add((Control) this.m_remoteradioButton);
    ((Control) this).Controls.Add((Control) this.m_localradioButton);
    ((Control) this).Controls.Add((Control) this.m_port);
    ((Control) this).Controls.Add((Control) this.m_portLabel);
    ((Control) this).Controls.Add((Control) this.m_IP);
    ((Control) this).Controls.Add((Control) this.m_name);
    ((Control) this).Controls.Add((Control) this.label3);
    ((Control) this).Controls.Add((Control) this.m_hostNameLabel);
    ((Control) this).Controls.Add((Control) this.label1);
    ((Control) this).Controls.Add((Control) this.m_okButton);
    ((Form) this).MaximizeBox = false;
    ((Form) this).MinimizeBox = false;
    ((Control) this).Name = nameof (CUiPLCSimAdvacnedConnection);
    ((Form) this).ShowIcon = false;
    ((Form) this).SizeGripStyle = SizeGripStyle.Hide;
    ((Form) this).FormClosing += new FormClosingEventHandler(this.Action_FormClosing);
    ((Control) this).ResumeLayout(false);
    ((Control) this).PerformLayout();
  }
}
